// a as b   a 断言为 b数据类型

// const val: string = 'hello'
// let val = '10000' // 鼠标移上去 可以看到 val的数据类型为string

let val;
let len = (val as string).length; // len number
const div = document.getElementById("div");
// div.style.color = '#f66' // div”可能为 “null”
(div as HTMLDivElement).style.color = "#f66";

let aaaa = "测试";
// aaaa = 10

let bb;
bb = "cc";
// bb = 10000

let len1 = (<string>bb).length; // 类型推断
let len2 = (bb as string).length; // 类型推断  推荐
